package com.hfdg.prototype.base.model;

/**
 * @ClassName AjaxResult
 * @Description TODO 异步消息实体类
 * @Author yuelh
 * @Date 2018/11/27 17:45
 * @Version 1.0
 * @Company 会飞的锅工作室
 **/
public class AjaxResult {
    int code;
    String msg;
    Object data;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMsg() {
        return msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public Object getData() {
        return data;
    }

    public void setData(Object data) {
        this.data = data;
    }

    public static AjaxResult error(){
        AjaxResult asynData = new AjaxResult();
        asynData.setCode(1);
        asynData.setMsg("system_error");
        return asynData;
    }
    public static AjaxResult error(int code, String msg){
        AjaxResult asynData = new AjaxResult();
        asynData.setCode(code);
        asynData.setMsg(msg);
        return asynData;
    }
    public static AjaxResult success(){
        AjaxResult asynData = new AjaxResult();
        asynData.setCode(0);
        asynData.setMsg("success");
        return asynData;
    }
    public static AjaxResult success(Object data){
        AjaxResult asynData = new AjaxResult();
        asynData.setCode(0);
        asynData.setMsg("success");
        asynData.setData(data);
        return asynData;
    }

}
